<?php
/*
 * @Description: 
 * @Author: Leequik
 * @Date: 2023-05-11 19:34:44
 * @LastEditTime: 2023-10-11 18:50:26
 * @LastEditors: Leequik
 */

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use Illuminate\Support\Facades\Route;
use App\Http\Middleware\HomeService;
use Illuminate\Support\Facades\View;

//Route::any('{all}','WebController@index')->where(['all'=>'.*']);

/********************** 前台路由 start *********************************/



//首页加载
Route::get('/home','Home\HomeController@index');
Route::redirect('/', '/home'); //路由重定向

//home下的路由配置

Route::group(['prefix'=>'home'],function(){
    //Route::get('/','home\HomeController@index');

    //用户登陆
    Route::get('login', 'Home\UserController@login');
    //用户退出
    Route::get('logout', 'Home\UserController@logout');
});



Route::get('/test/get','TestController@get');
Route::post('/test/post','TestController@post');

/********************** 前台路由 end *********************************/


/********************** 后台路由 end *********************************/
Route::get('/admin','Backend\AdminController@index');

/********************** 后台台路由 end *********************************/



/******************************test**********************************/


//compact
Route::get('compact/{title?}',function($title='我是标题',$name='I am name'){
    return view('test',compact('title','name'));
});

Route::get('/test3',function(){
    /*
    $list=[
        'name'=>'leequik',
        'age'=>18,
        'email'=>'leequik@163.com'
    ];
*/

    $list=array(
        array(
            'name'=>'leequik',
            'age'=>18,
            'email'=>'leequik@163.com'
        ),
        array(
            'name'=>'yu',
            'age'=>16,
            'email'=>'yu@163.com'
        )       
    );
    return View('test',compact('list'));
    //return 'Hello World';
});

//判断视图文件是否存在
Route::get('/test2',function(){
    if(View::exists('test')){
        echo '视图存在';
    }else{
        echo '视图不存在';
    }
});






/****************************************************************/

//引入vue中的路由

Route::get('/{any}',function(){
    return view('index');
    
})->where('any','.*');







